<template>
  <div class="scroller">
    <div class="header">
      <h2 v-if="title!=undefined">{{title}}</h2>
    </div>
    <div class="content">
      <slot name="promItem"></slot>
      <ul class="hasCover" v-if="type === 'hasCover'">
        <li v-for="item in items.list">
          <div>
            <span class="titles">{{item.title}}</span>
            <div class="router">
              <div>
                <img v-if="item.tr" :src="item.tr[0].player1logo" alt="item.tr[0].player1" />
                <div>{{item.tr[0].player1}}</div>
              </div>
              <span class="title">VS</span>
              <div>
                <img v-if="item.tr" :src="item.tr[0].player2logo" alt="item.tr[0].player2" />
                <div>{{item.tr[0].player2}}</div>
              </div>
            </div>
            <span class="titless">{{item.tr[0].score}}</span>
            <div>
              <a
                v-if="item.tr[0].status=='2'"
                @click="See(item.tr[0].m_link1url)"
                class="titless"
              >{{item.tr[0].link1text}}</a>
            </div>
            <div
              v-if="item.tr[0].status=='1'"
              @click="See(item.tr[0].m_link1url)"
              class="titless"
            >{{item.tr[0].link1text}}</div>
            <div
              v-if="item.tr[0].status=='0'"
              @click="See(item.tr[0].m_link1url)"
              class="titless"
            >{{item.tr[0].link1text}}</div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
/* eslint-disable */
import Rating from "./Rating";

export default {
  name: "shownba",
  props: ["title", "type", "items"],
  components: { Rating },
  data() {
    return {};
  },
  methods: {
    // Dispatching getBook
    See: function(e) {
      window.location.href = e;
    }
  }
};
</script>

<style lang="scss" scoped>
.scroller {
  padding-top: 1rem;
}

.header {
  text-align: center;
  height: 2.6rem;
  line-height: 2.6rem;
  padding: 0 1.6rem;

  a {
    float: right;
    font-size: 1.44rem;
    &:last-child {
      color: #42bd56;
    }
  }

  h2 {
    display: inline-block;
  }
}

.content {
  box-sizing: content-box;

  ul {
    padding: 0.8rem 0;
  }
}

.hasCover {
  overflow-x: auto;
  white-space: nowrap;
  text-align: center;

  .title {
    text-align: center;
    display: block;
    max-width: 100%;
    line-height: 11.3rem;
    font-size: 1.6rem;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-wrap: normal;
    margin-left: 2rem;
    margin-right: 2rem;
  }
  .titles {
    text-align: center;
    display: block;
    max-width: 100%;
    width: 100%;
    font-size: 1.6rem;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-wrap: normal;
  }
  .titless {
    text-align: center;
    display: block;
    max-width: 100%;
    width: 100%;
    font-size: 1.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-wrap: normal;
    color: #490ee8;
    margin-top: 1rem;
  }
  .router {
    display: flex;
    justify-content: center;
    align-items: center;
    float: left;
    width: 40.2rem;
    height: 11rem;
    text-align: center;
    line-height: 3rem;
    margin-bottom: 0.5rem;
  }

  li {
    margin: 1rem;
    width: 39.2rem;
    height: 20rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  li:first-child {
  }

  img {
    height: 12rem;
  }
}

.onlyString {
  overflow-x: auto;
  white-space: nowrap;

  li {
    display: inline-block;
    margin: 0 0 0.8rem 1.6rem;
    font-size: 1.6rem;
    border: solid 0.1rem;
    border-radius: 0.4rem;
    vertical-align: middle;
  }

  a {
    height: 5rem;
    line-height: 5rem;
    padding: 0 2.4rem;
    letter-spacing: 0.16rem;
    overflow: auto;
    display: block;
    text-align: center;
  }

  li:empty {
    width: 100%;
    display: block;
    height: 0.1rem;
    border: 0;
    margin: 0;
  }
}
</style>
